package com.nanhai.buddhist.college.module.collegebase.controller.admin.teacherteachers.vo;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

public class TeacherSexConvert implements Converter<String>{

    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }


    @Override
    public String convertToJavaData(@SuppressWarnings("rawtypes") CellData cellData, ExcelContentProperty contentProperty,
                                    GlobalConfiguration globalConfiguration) throws Exception {
        String cellDataStr = cellData.getStringValue();

        return null;
    }

    /**
     *
     * 方法用途: 写的时候会调用<br>
     * 实现步骤: 0正常 1关闭<br>
     * @param value
     * @param contentProperty
     * @param globalConfiguration
     * @return
     * @throws Exception
     */
    @Override
    public CellData<String> convertToExcelData(String value, ExcelContentProperty contentProperty,
                                               GlobalConfiguration globalConfiguration) throws Exception {
        if(value.equals("1")) {
            return new CellData<>("男");
        }else if(value.equals("2")) {
            return new CellData<>("女");
        }
        return new CellData<>("");
    }
}
